# -*- coding: utf-8 -*-
# @Time    : 2024/2/23  11:34
# @Author  : zhanghao
# @FileName: config.py
# @Software: PyCharm
"""
    Description:
        
"""
from logger import Logger

import os
import json


class Config:
    logger = Logger.get()

    current_dir = ''
    names = []
    passwords = []

    def __init__(self):
        self.current_dir = os.getcwd()
        self.logger.info(self.current_dir)

    def initConfig(self):
        self.logger.info('加载配置.........' + self.current_dir)
        conf_path = 'D:/loginoa/user.json'

        with open(conf_path, 'r', encoding='utf-8') as f:
            conf_json = json.load(f)

        self.logger.info(conf_json)
        if conf_json and conf_json['user'] and len(conf_json['user']) > 0:
            self.names = []
            self.passwords = []
            for user in conf_json['user']:
                if user['name'] and user['password']:
                    self.names.append(user['name'])
                    self.passwords.append(user['password'])
